package com.hmdp.controller;


import com.hmdp.dto.Result;
import com.hmdp.service.IFollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 虎哥
 * @since 2021-12-22
 */
@RestController
@RequestMapping("/follow")
public class FollowController {
    @Autowired
    private IFollowService followService;
    /**
     * 实现关注的功能
     * @param followUserId
     * @param isFollow
     * @return
     */
    @PutMapping("/{id}/{isFollow}")
    public Result follow(@PathVariable("id")Long followUserId,@PathVariable("isFollow") Boolean isFollow){

        return followService.follow(followUserId,isFollow);

    }

    /**
     * 查询关注的功能
     * @param followUserId
     * @return
     */
    @GetMapping("or/not/{id}")
    public Result isFollow(@PathVariable("id")Long followUserId){

        return followService.isFollow(followUserId);


}
    @GetMapping("/common/{id}")
    public Result followCommons(@PathVariable("id")Long followUserId){
        return followService.followUserId(followUserId);
    }


}
